﻿

    
var statisticsConfig = window.parent.$("#fmap")[0].contentWindow.m_MapConfigLayers.statisticsModule;
setTimeout(function () {
    if (statisticsConfig.visible) {
        showStatisticsTable("土地利用现状一级分类汇总");
    }  
}, 5000)
  
window.showStatisticsTable = function (title) {
    var xzq = statisticsConfig.xzqCode;
    //k1
    if (title === "土地利用现状一级分类汇总") {
        document.getElementById("statisticsTable").innerHTML = window.k1;
        
        getStatisticsData(title, xzq);
    }
        //k2
    else if (title === "土地利用现状分类面积汇总") {
        document.getElementById("statisticsTable").innerHTML = k2;
        getStatisticsData2(title, xzq);
    }
        //k3
    else if (title === "土地利用现状一级分类面积按权属性质汇总") {
        document.getElementById("statisticsTable").innerHTML = k3;
        getStatisticsData3(title, xzq);
    }
        //k4
    else if (title === "城镇村及工矿用地面积汇总表") {
        document.getElementById("statisticsTable").innerHTML = k4;
        getStatisticsData4(title, xzq);
    }
        //k5
    else if (title === "耕地坡度分级面积汇总") {
        document.getElementById("statisticsTable").innerHTML = k5;
        getStatisticsData5(title, xzq);
    }
        //k6
    else if (title === "耕地种植类型面积统计") {
        document.getElementById("statisticsTable").innerHTML = k6;
        getStatisticsData6(title, xzq);
    }
        //k7
    else if (title === "林区范围内园地汇总统计") {
        document.getElementById("statisticsTable").innerHTML = k7;
        getStatisticsData7(title, xzq);
    }
        //k8
    else if (title === "灌丛草地汇总情况统计") {
        document.getElementById("statisticsTable").innerHTML = k8;
        getStatisticsData8(title, xzq);
    }
        //k9
    else if (title === "工业仓储用地按类型汇总统计") {
        document.getElementById("statisticsTable").innerHTML = k9;
        getStatisticsData9(title, xzq);
    }
        //k10
    else if (title === "可调整地类面积汇总") {
        document.getElementById("statisticsTable").innerHTML = k10;
        getStatisticsData10(title, xzq);
    }
        //k11
    else if (title === "部分细化地类面积汇总") {
        document.getElementById("statisticsTable").innerHTML = k11;
        getStatisticsData11(title, xzq);
    }
        //k12
    else if (title === "耕地细化调查情况统计") {
        document.getElementById("statisticsTable").innerHTML = k12;
        getStatisticsData12(title, xzq);
    }
        //k13
    else if (title === "批准未建设的建设用地用途情况统计") {
        document.getElementById("statisticsTable").innerHTML = k13;
        getStatisticsData13(title, xzq);
    }
        //k14
    else if (title === "批准未建设的建设用地现状情况统计") {
        document.getElementById("statisticsTable").innerHTML = k14;
        getStatisticsData14(title, xzq);
    }
        //k15
    else if (title === "永久基本农田现状情况统计") {
        document.getElementById("statisticsTable").innerHTML = k15;
        getStatisticsData15(title, xzq);
    }
        //k17
    else if (title === "废弃与垃圾填埋细化标注汇总统计") {
        document.getElementById("statisticsTable").innerHTML = k17;
        getStatisticsData17(title, xzq);
    }
        //k18
    else if (title === "即可恢复与工程恢复种植属性汇总统计") {
        document.getElementById("statisticsTable").innerHTML = k18;
        getStatisticsData18(title, xzq);
    }
        //三大类
    else if (title === "三大类统计") {
        document.getElementById("statisticsTable").innerHTML = threeType;
        getStatisticsDataThreeType(title, xzq);
    }
        //一级地类流向
    else if (title === "一级地类流向统计") {
        document.getElementById("statisticsDIV").style.height = "85%";
        document.getElementById("statisticsTable").innerHTML = yijidilei;
        getStatisticsDataYijidilei(title, xzq);
    }
        //二级地类流向
    else if (title === "二级地类流向统计") {
        document.getElementById("statisticsTable").innerHTML = erjidilei;
        getStatisticsDataErjidilei(title, xzq);
    }
        //k2
    else if (title === "土地利用现状分类面积汇总") {
        document.getElementById("statisticsTable").innerHTML = k2;
        getStatisticsData2(title, xzq);
    }
        //专题统计
    else if (title === "专题地类流向统计") {
        document.getElementById("statisticsTable").innerHTML = zhuanti;
        getStatisticsDataZhuanTi(title, xzq);
    }
};

function getStatisticsData(title, xzq) {

    //LinkToMap(title, xzq, "xzq");
    $("#table2").empty();
    var obj = obj2 = {
        stype: "K1",
        mtype: "数据表",
        xzq: xzq
    };
    var perValue = [];
    var perSumValue = [];
    var myparam = "";
    nameArr = ["湿地", "耕地", "种植园用地", "林地", "草地", "商业服务业用地", "工矿用地", "住宅用地", "公共管理与公共服务用地", "特殊用地", "交通运输用地", "水域及水利设施用地", "其他土地"];
    $.ajax({
        type: "post",
        async: false,
        url: statisticsConfig.ajax,
        data: obj, //发送到服务器的参数
        datatype: "json",
        success: function (result) {
            if (result) {
                var strs = new Array(); //定义一数组
                strs = result.split("||"); //字符分割
                for (i = 0; i < strs.length; i++) {
                    if (i == 0)
                        perValue = strs[0];
                    else if (i == 1)
                        perSumValue = strs[1];
                }
                var perSumValue = JSON.parse(perSumValue);
                var perValue1 = JSON.parse(perValue);
                myparam = perValue1[0].MC;
                var tbody = document.getElementById('table2');
                for (var i = 0; i < perValue1.length; i++) { //遍历一下json数据
                    var trow = getDataRow(i, perValue1[i]); //定义一个方法,返回tr数据
                    tbody.appendChild(trow);
                }
                trow = getNullDataRow(1, perValue1[0]); //定义一个方法,返回tr数据
                tbody.appendChild(trow);
                for (var i = 0; i < perSumValue.length; i++) { //遍历一下json数据
                    var trow = getSumDataRow(i, perSumValue[i]); //定义一个方法,返回tr数据
                    if ((perSumValue[i].DM).toString().length <= 9) {
                        trow.setAttribute("onclick", "getStatisticsData(" + "'" + title + "'" + "," + "'" + perSumValue[i].DM + "'" + ")");
                        //trow.setAttribute("onclick","alert(22)");
                    } else {
                        trow.setAttribute("onclick", "getStatisticsData(" + "'" + title + "'" + "," + "'" + perSumValue[i].DM + "'" + ",'xzq')");
                    }
                    tbody.appendChild(trow);
                }
            }
        }
    });
    var value1 = [];
    var xAxis1 = [];
    $.ajax({
        type: "post",
        async: false,
        url: statisticsConfig.ajax,
        data: obj,
        datatype: "json",
        success: function (result) {
            if (result) {
                var strs = new Array(); //定义一数组 
                strs = result.split("||"); //字符分割 
                var Landtype;
                for (i = 0; i < strs.length; i++) {
                    if (i == 0)
                        Fathervalue = strs[0];
                    else if (i == 1)
                        Childvalue = strs[1];
                    // else
                    //     Landtype = strs[2];
                }
                var fathervalue = JSON.parse(Fathervalue);
                var childvalue = JSON.parse(Childvalue);
                // var landtype = JSON.parse(Landtype);
                var newfathervalue = [];
                var newlandtype = [];
                for (var i in fathervalue[0]) {
                    if (i == "MC" || i == "DM" || i.match("_") || i.match("ZMJ"))
                        continue;
                    newfathervalue.push(fathervalue[0][i]);
                }
                var EchartsTitle = "";
                //document.getElementById("EchartsBarDiv").style.display = "block";
                echartsDiv = document.getElementById("bardiv");
                EchartsTitle = title + "柱形图";
                showEchartsBar(echartsDiv, nameArr, newfathervalue, "面积", title);
                var newlandtypeValue = [];
                for (var i = 0; i < nameArr.length; i++) {
                    var obj = new Object();
                    obj.name = nameArr[i];
                    obj.value = newfathervalue[i];
                    newlandtypeValue.push(obj);
                }
                //document.getElementById("EchartsPieDiv").style.display = "block";
                echartsDiv2 = document.getElementById("piediv");
                EchartsTitle = title + "饼形图";
                //document.getElementById("echartslable").innerHTML = EchartsTitle;
                showEchartsPie(echartsDiv2, nameArr, newlandtypeValue, "面积", title);
            }
        }
    });
}

function getStatisticsData2(title, xzq) {
    //LinkToMap(title, xzq, "xzq");
    $("#table2").empty();
    var perValue = [];
    var perColName = [];
    var Landtype = []; //二级地类
    var Fatherlandtype = []; //一级地类
    var FatherName = [];
    var Childvalue = [];
    var hejiData;
    var Myland = [];
    var Theparam = "";
    var mylandvalue = [];
    var newValue = [];
    var mynums = [];
    $.ajax({
        type: "post",
        async: false,
        //url: "http://192.168.1.11:8014/Ajax.ashx",
        url: statisticsConfig.ajax,
        data: //发送到服务器的参数
        {
            stype: "K2",
            mtype: "新数据",
            xzq: xzq,
            text: "湿地"
        },
        datatype: "json",
        success: function (result) {
            if (result) {
                var strs = new Array(); //定义一数组 
                strs = result.split("||"); //字符分割 
                for (i = 0; i < strs.length; i++) {
                    if (i == 0)
                        perValue = strs[0];
                    else if (i == 1)
                        perSumValue = strs[1];
                    else if (i == 2)
                        Landtype = strs[2];
                    else if (i == 3)
                        Fatherlandtype = strs[3];
                    else if (i == 4)
                        Myland = strs[4];
                    else
                        Theparam = strs[5];
                }
                var perSumValue = JSON.parse(perSumValue);
                var perValue1 = JSON.parse(perValue);
                hejiData = perValue1;
                var landtype = JSON.parse(Landtype);
                var fatherlandtype = JSON.parse(Fatherlandtype);
                var myland = JSON.parse(Myland);
                var newmyland = [];
                for (var i = 0; i < myland.length; i++) {
                    newmyland.push(myland[i].FD_VALUE);
                }
                var theparam = "K" + Theparam;
                for (var i = 0; i < fatherlandtype.length; i++) {
                    //var newOption = document.createElement("option");
                    if (fatherlandtype[i].FD_VALUE == "特殊用地")
                        continue;
                    //newOption.text = fatherlandtype[i].FD_VALUE;
                    FatherName.push(fatherlandtype[i].FD_VALUE);
                    //document.getElementById("selection").add(newOption);
                }
                var tbody = document.getElementById('table2');
                for (var i = 0; i < perValue1.length; i++) { //遍历一下json数据 
                    var trow = getDataRow(i, perValue1[i]); //定义一个方法,返回tr数据 
                    tbody.appendChild(trow);
                }
                trow = getNullDataRow(1, perValue1[0]); //定义一个方法,返回tr数据 
                tbody.appendChild(trow);
                for (var i = 0; i < perSumValue.length; i++) { //遍历一下json数据 
                    var trow = getSumDataRow(i, perSumValue[i]); //定义一个方法,返回tr数据 
                    if ((perSumValue[i].DM).toString().length <= 9) {
                        trow.setAttribute("onclick", "getStatisticsData2(" + "'" + title + "'" + "," + "'" + perSumValue[i].DM + "'" + ")");
                    } else {
                        trow.setAttribute("onclick", "getStatisticsData2(" + "'" + title + "'" + "," + "'" + perSumValue[i].DM + "'" + ",'xzq')");
                    }
                    tbody.appendChild(trow);
                }
                for (var i in perValue1[0]) {
                    if (i.indexOf(theparam) != -1)
                        mylandvalue.push(perValue1[0][i]);
                }
                mylandvalue.shift();
                var mypercent = [];
                for (var i = 0; i < myland.length; i++) {
                    mypercent.push(Number(mylandvalue[i] / perValue1[0].K01).toFixed(3));
                }
                for (var i in hejiData[0]) {
                    if (i == "SUM(K09)" || i == "K09")
                        continue;
                    //                       if(i.length == 8 && i.indexOf('K')>=0){
                    //                           newValue.push(hejiData[0][i]);
                    //                       }
                    if (i.match("SUM")) {
                        if (i.match("K") && i.length == 8) {
                            newValue.push(hejiData[0][i]);
                        }
                    } else {
                        if (i.match("K") && i.length == 3) {
                            newValue.push(hejiData[0][i]);
                        }
                    }
                }
                for (var i = 0; i < FatherName.length; i++) {
                    var obj1 = new Object();
                    obj1.name = FatherName[i];
                    obj1.value = newValue[i];
                    mynums.push(obj1);
                }
                var EchartsTitle = "";
                //document.getElementById("EchartsBarDiv").style.display = "block";
                var echartsDiv = document.getElementById("bardiv");
                EchartsTitle = title + "柱形图";
                showEchartsBar(echartsDiv, FatherName, newValue, "面积", title);
                //document.getElementById("EchartsPieDiv").style.display = "block";
                var echartsDiv2 = document.getElementById("piediv");
                EchartsTitle = title + "饼形图";
                //document.getElementById("echartslable").innerHTML = EchartsTitle;
                showEchartsPie(echartsDiv2, FatherName, mynums, "面积", title);
            }
        }
    });
}

function getStatisticsData3(title, xzq) {
    //LinkToMap(title, xzq, "xzq");
    $("#table2").empty();
    var obj = {
        stype: "K3",
        mtype: "数据表",
        xzq: xzq
    };
    var obj2 = {
        stype: "K3",
        // mtype: "堆叠柱状图",
        mtype: "新柱状图",
        xzq: xzq
    };
    var perValue = [];
    var perSumValue = [];
    var myparam = "";
    nameArr = ["湿地", "耕地", "种植园用地", "林地", "草地", "商业服务业用地", "工矿用地", "住宅用地", "公共管理与公共服务用地", "特殊用地", "交通运输用地", "水域及水利设施用地", "其他土地"];
    $.ajax({
        type: "post",
        async: false,
        url: statisticsConfig.ajax,
        data: obj, //发送到服务器的参数
        datatype: "json",
        success: function (result) {
            if (result) {
                var strs = new Array(); //定义一数组
                strs = result.split("||"); //字符分割
                for (i = 0; i < strs.length; i++) {
                    if (i == 0)
                        perValue = strs[0];
                    else if (i == 1)
                        perSumValue = strs[1];
                }
                var perValue1 = JSON.parse(perValue);
                var perSumValue = JSON.parse(perSumValue);
                //myparam = perValue1[0].MC;
                var tbody = document.getElementById('table2');
                for (var i = 0; i < perValue1.length; i++) { //遍历一下json数据
                    var trow = getDataRow(i, perValue1[i]); //定义一个方法,返回tr数据
                    tbody.appendChild(trow);
                }
                trow = getNullDataRow(1, perValue1[0]); //定义一个方法,返回tr数据
                tbody.appendChild(trow);
                for (var i = 0; i < perSumValue.length; i++) { //遍历一下json数据
                    var trow = getSumDataRow(i, perSumValue[i]); //定义一个方法,返回tr数据
                    if ((perSumValue[i].DM).toString().length <= 9) {
                        trow.setAttribute("onclick", "getStatisticsData3(" + "'" + title + "'" + "," + "'" + perSumValue[i].DM + "'" + ")");
                    } else {
                        trow.setAttribute("onclick", "getStatisticsData3(" + "'" + title + "'" + "," + "'" + perSumValue[i].DM + "'" + ",'xzq')");
                    }
                    tbody.appendChild(trow);
                }
            }
        }
    });
    var value1 = [];
    var xAxis1 = [];
    var typenames = []; //地的类型
    var xingzhengqudata = []; //x坐标值
    var seriesdata = []; //y坐标值
    $.ajax({
        type: "post",
        async: false,
        url: statisticsConfig.ajax,
        data: obj2,
        datatype: "json",
        success: function (result) {
            if (result) {
                var names = []; //
                var nums = [];
                var data1 = []; //国家所有
                var data2 = []; //集体所有
                var perValue = JSON.parse(result);
                // for (var i = 0; i < perValue.length; i++) { //遍历一下json数据                     
                //     var perValue1 = perValue[i];
                //     //xingzhengqudata.push(perValue1.prov);
                //     //data1.push(perValue1.dataval);SUM(GJSY)
                //     //data2.push(perValue1.dataval2);
                //     data1.push(perValue1["SUM(GJSY)"]);
                //     data2.push(perValue1["SUM(JTSY)"]);
                // }
                for (var i in perValue[0]) {
                    if (i.indexOf("_GJSY") > -1)
                        data1.push(perValue[0][i]);
                    if (i.indexOf("_JTSY") > -1)
                        data2.push(perValue[0][i]);
                }
                var seriesdatas1 = new Object();
                seriesdatas1["name"] = '国家所有';
                seriesdatas1["type"] = 'bar';
                seriesdatas1["data"] = data1;
                seriesdatas1["itemStyle"] = {
                    normal: {
                        label: {
                            show: true, //开启显示
                            position: 'top', //在上方显示
                            textStyle: { //数值样式
                                color: 'white',
                                fontSize: 12
                            }
                        }
                    }
                };
                seriesdata.push(seriesdatas1);
                var seriesdatas2 = new Object();
                seriesdatas2["name"] = '集体所有';
                seriesdatas2["type"] = 'bar';
                seriesdatas2["data"] = data2;
                seriesdatas2["itemStyle"] = {
                    normal: {
                        label: {
                            show: true, //开启显示
                            position: 'top', //在上方显示
                            textStyle: { //数值样式
                                color: 'white',
                                fontSize: 12
                            }
                        }
                    }
                };
                //document.getElementById("EchartsBarDiv").style.display = "block";
                seriesdata.push(seriesdatas2);
                var echartsDiv = document.getElementById("bardiv");
                xingzhengqudata = ["国家所有", "集体所有"];
                showEchartsBar2(echartsDiv, nameArr, seriesdata, "面积", title);
                // var names = [];            
                // var nums = [];
                // var data = []; //存放解析结果的数值
                // var data2 = []; //存放解析结果的百分比  
                // var s = 0;
                // var obj = JSON.parse(result);
                // for (var i = 0; i < obj.length; i++) {
                //     data.push(obj[i].dataval);
                //     s = s + data[i];;
                // }
                // for (var i = 0; i < obj.length; i++) {
                //     var d = Number(obj[i].dataval / s).toFixed(2);
                //     data2.push(d);
                // }
                // for (var i = 0; i < obj.length; i++) {
                //     names.push(obj[i].prov);                
                //     var obj1 = new Object();                
                //     obj1.name = obj[i].prov;                
                //     obj1.value = obj[i].dataval;                
                //     nums.push(obj1);
                // }
                // //document.getElementById("EchartsPieDiv").style.display = "block";
                // var echartsDiv2 = document.getElementById("piediv");
                // EchartsTitle = title + "饼形图";
                // //document.getElementById("echartslable").innerHTML = EchartsTitle;
                // showEchartsPie(echartsDiv2, names, nums, "面积", title);
            }
        }
    })
}

function getStatisticsData4(title, xzq) {
    $("#table2").empty();
    var perValue = [];
    var perColName = [];
    var myparam = "";
    var fathertype = []; //存放城市、建制镇、村庄、盐田及采矿用地、特殊用地
    var childtype = []; //存放其下的几种类型的地
    var childtypex = []; //存放盐田及采矿用地的几种类型的地
    var childtypexx = []; //存放特殊用地的几种类型的地

    var data0 = []; //合计
    var data1 = []; //城镇村及工矿用地
    var data2 = []; //城市
    var data3 = []; //建制镇
    var data4 = []; //村庄
    var data5 = []; //盐田及采矿用地
    var data6 = []; //特殊用地

    var data = [];
    var childdata3 = [];
    var childdata1 = [];
    var childdata2 = [];
    var typenames = []; //类型
    var xingzhengqudata = []; //x坐标值
    var seriesdata = []; //y坐标值
    var xingzhengqudata2 = []; //合计选项的x坐标值

    $.ajax({
        type: "post",
        async: false,
        url: statisticsConfig.ajax,
        data: //发送到服务器的参数
        {
            stype: "K4",
            mtype: "新数据",
            xzq: xzq,
            text: "'城镇村及工矿用地'"
        },
        datatype: "json",
        success: function (result) {
            if (result) {
                var strs = new Array(); //定义一数组 
                strs = result.split("||"); //字符分割 
                for (i = 0; i < strs.length; i++) {
                    if (i == 0)
                        perValue = strs[0];
                    else if (i == 1)
                        perSumValue = strs[1];
                    else if (i == 2)
                        fathertype = strs[2];
                    else if (i == 3)
                        childtype = strs[3];
                    else if (i == 4)
                        childtypex = strs[4];
                    else if (i == 5)
                        childtypexx = strs[5];
                }
                var perSumValue = JSON.parse(perSumValue);
                var perValue1 = JSON.parse(perValue);
                var fathertype1 = JSON.parse(fathertype);
                var childtype1 = JSON.parse(childtype);
                var childtype2 = JSON.parse(childtypex);
                var childtype3 = JSON.parse(childtypexx);
                var tbody = document.getElementById('table2');
                myparam = perSumValue[0].MC;

                xingzhengqudata2.push("城镇村及工矿用地");
                for (var i = 0; i < fathertype1.length; i++) {
                    // var newOption = document.createElement("option");
                    // newOption.text = fathertype1[i].DLMC;
                    xingzhengqudata2.push(fathertype1[i].DLMC);
                    //document.getElementById("selection").add(newOption);
                }

                for (var i = 0; i < perValue1.length; i++) { //遍历一下json数据 
                    var trow = getSumDataRow(i, perValue1[i]); //定义一个方法,返回tr数据 
                    tbody.appendChild(trow);
                }

                trow = getNullDataRow(1, perValue1[0]); //定义一个方法,返回tr数据 
                tbody.appendChild(trow);

                for (var i = 0; i < perSumValue.length; i++) { //遍历一下json数据 
                    var trow = getDataRow(i, perSumValue[i]); //定义一个方法,返回tr数据 

                    if ((perSumValue[i].DM).toString().length <= 9) {
                        trow.setAttribute("onclick", "getStatisticsData4(" + "'" + title + "'" + "," + "'" + perSumValue[i].DM + "'" + ")");
                    } else {
                        trow.setAttribute("onclick", "javascript:location.href=('#');");
                    }
                    tbody.appendChild(trow);
                }

                for (var i = 0; i < childtype1.length; i++) {
                    childdata3.push(childtype1[i].FD_VALUE);
                }
                for (var i = 0; i < childtype2.length; i++) {
                    childdata1.push(childtype2[i].FD_VALUE);
                }
                for (var i = 0; i < childtype3.length; i++) {
                    childdata2.push(childtype3[i].FD_VALUE);
                }
                var nums = [];

                for (var i in perSumValue[0]) { //遍历一下json数据  
                    if (i == "DM" || i == "MC")
                        continue;
                    if (i.match("SUM")) {
                        if (perSumValue[0][i] != null) {

                        } else {
                            perSumValue[0][i] = 0;
                        }
                        if (i.match("_ZJ") || i.match("_XJ"))
                            data0.push(perSumValue[0][i]);
                        if (i.match("K20_") && i.length == 11 && !i.match("K20_ZJ"))
                            data1.push(perSumValue[0][i]);
                        if (i.match("K201_") && i.length == 12 && !i.match("K201_XJ"))
                            data2.push(perSumValue[0][i]);
                        if (i.match("K202_") && i.length == 12 && !i.match("K202_XJ"))
                            data3.push(perSumValue[0][i]);
                        if (i.match("K203_") && i.length == 12 && !i.match("K203_XJ"))
                            data4.push(perSumValue[0][i]);
                        if (i.match("K204_") && i.length == 12 && !i.match("K204_XJ"))
                            data5.push(perSumValue[0][i]);
                        if (i.match("K205_") && i.length == 12 && !i.match("K205_XJ"))
                            data6.push(perSumValue[0][i]);
                    } else {
                        if (perSumValue[0][i] != null) {

                        } else {
                            perSumValue[0][i] = 0;
                        }
                        if (i.match("_ZJ") || i.match("_XJ"))
                            data0.push(perSumValue[0][i]);
                        if (i.match("K20_") && i.length == 6 && !i.match("K20_ZJ"))
                            data1.push(perSumValue[0][i]);
                        if (i.match("K201_") && i.length == 7 && !i.match("K201_XJ"))
                            data2.push(perSumValue[0][i]);
                        if (i.match("K202_") && i.length == 7 && !i.match("K202_XJ"))
                            data3.push(perSumValue[0][i]);
                        if (i.match("K203_") && i.length == 7 && !i.match("K203_XJ"))
                            data4.push(perSumValue[0][i]);
                        if (i.match("K204_") && i.length == 7 && !i.match("K204_XJ"))
                            data5.push(perSumValue[0][i]);
                        if (i.match("K205_") && i.length == 76 && !i.match("K205_XJ"))
                            data6.push(perSumValue[0][i]);
                    }

                }

                var echartsDiv = document.getElementById("container");
                showEchartsBar(echartsDiv, xingzhengqudata2, data0, "面积", title)

            }
        }
    })
}

function getStatisticsData5(title, xzq) {
    //LinkToMap(title, xzq, "xzq");
    $("#table2").empty();
    var perValue = [];
    var perSumValue = [];
    var Farmland = [];
    var x = [];
    var y = [];
    var myparam = "";
    var data1 = [];
    var data2 = [];
    var obj = {
        stype: "K5",
        mtype: "数据表",
        xzq: xzq
    };
    var obj2 = {
        stype: "K3",
        mtype: "堆叠柱状图",
        xzq: xzq
    };
    $.ajax({
        type: "post",
        async: false,
        url: statisticsConfig.ajax,
        data: obj,
        datatype: "json",
        success: function (result) {
            if (result) {
                var strs = new Array(); //定义一数组 
                strs = result.split("||"); //字符分割 
                for (i = 0; i < strs.length; i++) {
                    if (i == 0)
                        perSumValue = strs[0];
                    else if (i == 1)
                        perValue = strs[1];
                    else if (i == 2)
                        Farmland = strs[2];
                }
                var perSumValue = JSON.parse(perSumValue);
                var perValue1 = JSON.parse(perValue);
                var farmland = JSON.parse(Farmland);
                for (var i = 0; i < farmland.length; i++) {
                    x.push(farmland[i].FD_VALUE);
                }
                for (var i = 0; i < perSumValue.length; i++) {
                    for (var j in perSumValue[i]) {
                        if (j.match("PDMJ") || j.match("_HJ"))
                            y.push(perSumValue[i][j]);
                    }
                }
                for (var k in perSumValue[0]) {
                    if (k.match("_PD"))
                        data1.push(perSumValue[0][k]);
                    if (k.match("_TT"))
                        data2.push(perSumValue[0][k]);
                }
                var tbody = document.getElementById('table2');
                myparam = perSumValue[0].MC;
                for (var i = 0; i < perSumValue.length; i++) { //遍历一下json数据 
                    var trow = getSumDataRow(i, perSumValue[i]); //定义一个方法,返回tr数据 
                    tbody.appendChild(trow);
                }
                trow = getNullDataRow(1, perValue1[0]); //定义一个方法,返回tr数据 
                tbody.appendChild(trow);
                for (var i = 0; i < perValue1.length; i++) { //遍历一下json数据 
                    var trow = getDataRow(i, perValue1[i]); //定义一个方法,返回tr数据 
                    if ((perValue1[i].DM).toString().length <= 9) {
                        trow.setAttribute("onclick", "getStatisticsData5(" + "'" + title + "'" + "," + "'" + perValue1[i].DM + "'" + ")");
                    } else {
                        trow.setAttribute("onclick", "getStatisticsData5(" + "'" + title + "'" + "," + "'" + perValue1[i].DM + "'" + ",'xzq')");
                    }
                    tbody.appendChild(trow);
                }
                //var EchartsTitle = "";
                //document.getElementById("EchartsBarDiv").style.display = "block";
                var echartsDiv = document.getElementById("bardiv");
                //EchartsTitle = title + "柱形图";
                showEchartsBar(echartsDiv, x, y, "面积", title);
                var newlandtypeValue = [];
                for (var i = 0; i < x.length; i++) {
                    var obj = new Object();
                    obj.name = x[i];
                    obj.value = y[i];
                    newlandtypeValue.push(obj);
                }
                //document.getElementById("EchartsPieDiv").style.display = "block";
                var echartsDiv2 = document.getElementById("piediv");
                //EchartsTitle = title + "饼形图";
                //document.getElementById("echartslable").innerHTML = EchartsTitle;
                showEchartsPie(echartsDiv2, x, newlandtypeValue, "面积", title);
            }
        }
    });
}

function getStatisticsData6(title, xzq) {
    //LinkToMap(title, xzq, "xzq");
    $("#table2").empty();
    var perValue = [];
    var perSumValue = [];
    var Farmland = [];
    var x = [];
    var y = [];
    var myparam = "";
    var data1 = [];
    var data2 = [];
    var obj = {
        stype: "K6",
        mtype: "新数据",
        xzq: xzq,
        text: "'耕地'"
    };
    var obj2 = {
        stype: "K3",
        mtype: "堆叠柱状图",
        xzq: "4509"
    };
    $.ajax({
        type: "post",
        async: false,
        url: statisticsConfig.ajax,
        data: obj,
        datatype: "json",
        success: function (result) {
            if (result) {
                var strs = new Array(); //定义一数组 
                strs = result.split("||"); //字符分割 
                for (i = 0; i < strs.length; i++) {
                    if (i == 0)
                        perValue = strs[0];
                    else if (i == 1)
                        perSumValue = strs[1];
                    else if (i == 2)
                        fathertype = strs[2];
                    else if (i == 3)
                        childtype = strs[3];
                }
                var perValue1 = JSON.parse(perSumValue);
                var perSumValue = JSON.parse(perValue);
                var fathertype1 = JSON.parse(fathertype);
                var childtype1 = JSON.parse(childtype);
                var tbody = document.getElementById('table2');
                myparam = perSumValue[0].MC;
                // for (var i = 0; i < fathertype1.length; i++) {
                //     var newOption = document.createElement("option");
                //     newOption.text = fathertype1[i].FD_VALUE;
                //     document.getElementById("selection").add(newOption);
                // }
                for (var i = 0; i < perSumValue.length; i++) { //遍历一下json数据 
                    var trow = getSumDataRow(i, perSumValue[i]); //定义一个方法,返回tr数据 
                    tbody.appendChild(trow);
                }
                trow = getNullDataRow(1, perValue1[0]); //定义一个方法,返回tr数据 
                tbody.appendChild(trow);
                for (var i = 0; i < perValue1.length; i++) { //遍历一下json数据 
                    var trow = getDataRow(i, perValue1[i]); //定义一个方法,返回tr数据 
                    if ((perValue1[i].DM).toString().length <= 9) {
                        trow.setAttribute("onclick", "getStatisticsData6(" + "'" + title + "'" + "," + "'" + perValue1[i].DM + "'" + ")");
                    } else {
                        trow.setAttribute("onclick", "getStatisticsData6(" + "'" + title + "'" + "," + "'" + perValue1[i].DM + "'" + ",'xzq')");
                    }
                    tbody.appendChild(trow);
                }
                var data1 = []; //耕地
                var data2 = []; //水田
                var data3 = []; //水浇地
                var data4 = []; //旱地
                var data = [];
                var childdata = [];
                for (var i = 0; i < childtype1.length; i++) {
                    childdata.push(childtype1[i].FIELDALIASNAME.split('_')[1]);
                }
                var nums = [];
                for (var i in perSumValue[0]) { //遍历一下json数据                     
                    if (i.match("K01_"))
                        data1.push(perSumValue[0][i]);
                    if (i.match("K0101_"))
                        data2.push(perSumValue[0][i]);
                    if (i.match("K0102_"))
                        data3.push(perSumValue[0][i]);
                    if (i.match("K0103_"))
                        data4.push(perSumValue[0][i]);
                }
                for (var i = 0; i < childdata.length; i++) {
                    var obj1 = new Object();
                    obj1.name = childdata[i];
                    obj1.value = data1[i];
                    nums.push(obj1);
                }
                //var EchartsTitle = "";
                //document.getElementById("EchartsBarDiv").style.display = "block";
                var echartsDiv = document.getElementById("bardiv");
                EchartsTitle = title + "柱形图";
                showEchartsBar(echartsDiv, childdata, data1, "面积", title);
                //document.getElementById("EchartsPieDiv").style.display = "block";
                var echartsDiv2 = document.getElementById("piediv");
                //EchartsTitle = title + "饼形图";
                //document.getElementById("echartslable").innerHTML = EchartsTitle;
                showEchartsPie(echartsDiv2, childdata, nums, "面积", title);
            }
        }
    });
}

function getStatisticsData7(title, xzq) {
    //LinkToMap(title, xzq, "xzq");
    $("#table2").empty();
    var perValue = [];
    var perColName = [];
    var myparam = "";
    var obj = {
        stype: "K7",
        mtype: "数据表",
        xzq: xzq
    };
    $.ajax({
        type: "post",
        async: false,
        url: statisticsConfig.ajax,
        data: obj,
        datatype: "json",
        success: function (result) {
            if (result) {
                var strs = new Array(); //定义一数组
                strs = result.split("||"); //字符分割
                for (i = 0; i < strs.length; i++) {
                    if (i == 0)
                        perValue = strs[0];
                    else if (i == 1)
                        perSumValue = strs[1];
                }
                var perSumValue = JSON.parse(perSumValue);
                var perValue1 = JSON.parse(perValue);
                var tbody = document.getElementById('table2');
                myparam = perValue1[0].MC;
                for (var i = 0; i < perValue1.length; i++) { //遍历一下json数据
                    var trow = getDataRow(i, perValue1[i]); //定义一个方法,返回tr数据
                    tbody.appendChild(trow);
                }
                trow = getNullDataRow(1, perValue1[0]); //定义一个方法,返回tr数据
                tbody.appendChild(trow);
                for (var i = 0; i < perSumValue.length; i++) { //遍历一下json数据
                    var trow = getSumDataRow(i, perSumValue[i]); //定义一个方法,返回tr数据
                    if ((perSumValue[i].DM).toString().length <= 9) {
                        trow.setAttribute("onclick", "getStatisticsData7(" + "'" + title + "'" + "," + "'" + perSumValue[i].DM + "'" + ")");
                    } else {
                        trow.setAttribute("onclick", "getStatisticsData7(" + "'" + title + "'" + "," + "'" + perSumValue[i].DM + "'" + ",'xzq')");
                    }
                    tbody.appendChild(trow);
                }
            }
        }
    });
    var value1 = [];
    var xAxis1 = [];
    $.ajax({
        type: "post",
        async: false,
        url: statisticsConfig.ajax,
        data:   //发送到服务器的参数
        {
            stype: "K7",
            mtype: "新柱状图",
            xzq: xzq
        },
        datatype: "json",
        success: function (result) {
            if (result) {
                var strs = new Array(); //定义一数组
                strs = result.split("||"); //字符分割
                for (i = 0; i < strs.length; i++) {
                    if (i == 0)
                        Fathervalue = strs[0];
                    else if (i == 1)
                        Childvalue = strs[1];
                    else
                        Landtype = strs[2];
                }
                var fathervalue = JSON.parse(Fathervalue);
                var childvalue = JSON.parse(Childvalue);
                var landtype = JSON.parse(Landtype);
                var newfathervalue = [];
                var newlandtype = [];
                for (var i in fathervalue[0]) {
                    if (i.indexOf("K") >= 0) {
                        if (fathervalue[0][i] !== null)
                            newfathervalue.push(fathervalue[0][i]);
                        else
                            newfathervalue.push(0);
                    }
                }
                for (var i in landtype) {
                    newlandtype.push(landtype[i].FD_VALUE);
                }
                //var EchartsTitle = "";
                //document.getElementById("EchartsBarDiv").style.display = "block";
                var echartsDiv = document.getElementById("bardiv");
                //EchartsTitle = title + "柱形图";
                showEchartsBar(echartsDiv, newlandtype, newfathervalue, "面积", title);
            }
        }
    });
    var data = []; //存放解析结果的数值
    var data2 = []; //存放解析结果的百分比
    $.ajax({
        type: "post",
        async: false,
        url: statisticsConfig.ajax,
        data:   //发送到服务器的参数
        {
            stype: "K7",
            mtype: "新柱状图",
            xzq: xzq
        },
        datatype: "json",
        success: function (result) {
            if (result) {
                var strs = new Array(); //定义一数组
                strs = result.split("||"); //字符分割
                for (i = 0; i < strs.length; i++) {
                    if (i == 0)
                        Fathervalue = strs[0];
                    else if (i == 1)
                        Childvalue = strs[1];
                    else
                        Landtype = strs[2];
                }
                var fathervalue = JSON.parse(Fathervalue);
                var childvalue = JSON.parse(Childvalue);
                var landtype = JSON.parse(Landtype);
                var newfathervalue = [];
                var newlandtype = [];
                for (var i in fathervalue[0]) {
                    if (fathervalue[0][i] !== null)
                        newfathervalue.push(fathervalue[0][i]);
                    else
                        newfathervalue.push(0);
                }
                for (var i in landtype) {
                    newlandtype.push(landtype[i].FD_VALUE);
                }
                var names = [];
                var nums = [];
                for (var i = 0; i < newlandtype.length; i++) {
                    data.push(newfathervalue[i + 3]);
                }
                for (var i = 0; i < newlandtype.length; i++) {
                    var d = Number(newfathervalue[i + 3] / newfathervalue[2]).toFixed(3);
                    data2.push(d);
                }
                for (var i = 0; i < newlandtype.length; i++) {
                    //names.push(obj[i].prov);
                    var obj1 = new Object();
                    obj1.name = newlandtype[i];
                    obj1.value = newfathervalue[i + 3];
                    nums.push(obj1);
                }
                //document.getElementById("EchartsPieDiv").style.display = "block";
                var echartsDiv2 = document.getElementById("piediv");
                //EchartsTitle = title + "饼形图";
                //document.getElementById("echartslable").innerHTML = EchartsTitle;
                showEchartsPie(echartsDiv2, newlandtype, nums, "面积", title);
            }
        }
    });
}

function getStatisticsData8(title, xzq) {
    //LinkToMap(title, xzq, "xzq");
    $("#table2").empty();
    var x = [];
    var obj = {
        stype: "K8",
        mtype: "数据表",
        xzq: xzq
    };
    $.ajax({
        type: "post",
        async: false,
        url: statisticsConfig.ajax,
        data: obj,
        datatype: "json",
        success: function (result) {
            if (result) {
                var strs = new Array(); //定义一数组 
                strs = result.split("||"); //字符分割 
                for (i = 0; i < strs.length; i++) {
                    if (i == 0)
                        perValue = strs[0];
                    else if (i == 1)
                        perSumValue = strs[1];
                    else if (i == 2)
                        Grassland = strs[2];
                }
                var perValue1 = JSON.parse(perSumValue);
                var perSumValue = JSON.parse(perValue);
                var grassland = JSON.parse(Grassland);
                for (var i = 0; i < grassland.length; i++) {
                    x.push(grassland[i].FD_VALUE);
                }
                var tbody = document.getElementById('table2');

                for (var i = 0; i < perSumValue.length; i++) { //遍历一下json数据 
                    var trow = getSumDataRow(i, perSumValue[i]); //定义一个方法,返回tr数据 
                    tbody.appendChild(trow);
                }
                trow = getNullDataRow(1, perValue1[0]); //定义一个方法,返回tr数据 
                tbody.appendChild(trow);
                for (var i = 0; i < perValue1.length; i++) { //遍历一下json数据 
                    var trow = getDataRow(i, perValue1[i]); //定义一个方法,返回tr数据 
                    var dm = perValue1[i].DM;
                    if ((perValue1[i].DM).toString().length <= 9) {
                        trow.setAttribute("onclick", "getStatisticsData8(" + "'" + title + "'" + "," + "'" + perValue1[i].DM + "'" + ")");
                    } else {
                        trow.setAttribute("onclick", "getStatisticsData8(" + "'" + title + "'" + "," + "'" + perValue1[i].DM + "'" + ",'xzq')");
                    }
                    tbody.appendChild(trow);
                }
                var nums = [];
                var data = []; //天然牧草地
                for (var i in perSumValue[0]) { //遍历一下json数据                     
                    if (i.match("KGCCD04_"))
                        data.push(parseInt(perSumValue[0][i]));
                }
                //var EchartsTitle = "";
                //document.getElementById("EchartsBarDiv").style.display = "block";
                var echartsDiv = document.getElementById("bardiv");
                //EchartsTitle = title + "柱形图";
                showEchartsBar(echartsDiv, x, data, "面积", title);
                for (var i = 0; i < x.length; i++) {
                    var obj1 = new Object();
                    obj1.name = x[i];
                    obj1.value = data[i];
                    nums.push(obj1);
                }
                //document.getElementById("EchartsPieDiv").style.display = "block";
                var echartsDiv2 = document.getElementById("piediv");
                //EchartsTitle = title + "饼形图";
                //document.getElementById("echartslable").innerHTML = EchartsTitle;
                showEchartsPie(echartsDiv2, x, nums, "面积", title);
            }

        }
    })

}

function getStatisticsData9(title, xzq) {
    //LinkToMap(title, xzq, "xzq");
    $("#table2").empty();
    var perValue = [];
    var perColName = [];
    var myparam = "";
    var obj = {
        stype: "K9",
        mtype: "数据表",
        xzq: xzq
    }
    $.ajax({
        type: "post",
        async: false,
        url: statisticsConfig.ajax,
        data: obj,
        datatype: "json",
        success: function (result) {
            if (result) {
                var strs = new Array(); //定义一数组
                strs = result.split("||"); //字符分割
                for (i = 0; i < strs.length; i++) {
                    if (i == 0)
                        perValue = strs[0];
                    else if (i == 1)
                        perSumValue = strs[1];
                }
                var perValue1 = JSON.parse(perSumValue);
                var perSumValue = JSON.parse(perValue);
                var tbody = document.getElementById('table2');
                myparam = perValue1[0].MC;

                for (var i = 0; i < perSumValue.length; i++) { //遍历一下json数据
                    var trow = getSumDataRow(i, perSumValue[i]); //定义一个方法,返回tr数据
                    tbody.appendChild(trow);
                }
                trow = getNullDataRow(1, perValue1[0]); //定义一个方法,返回tr数据
                tbody.appendChild(trow);
                for (var i = 0; i < perValue1.length; i++) { //遍历一下json数据
                    var trow = getDataRow(i, perValue1[i]); //定义一个方法,返回tr数据
                    if ((perValue1[i].DM).toString().length <= 9) {
                        trow.setAttribute("onclick", "getStatisticsData9(" + "'" + title + "'" + "," + "'" + perValue1[i].DM + "'" + ")");
                    } else {
                        trow.setAttribute("onclick", "getStatisticsData9(" + "'" + title + "'" + "," + "'" + perValue1[i].DM + "'" + ",'xzq')");
                    }
                    tbody.appendChild(trow);
                }
            }
        }
    });
    var value1 = [];
    var xAxis1 = [];
    $.ajax({
        type: "post",
        async: false,
        url: statisticsConfig.ajax,
        data:   //发送到服务器的参数
        {
            stype: "K9",
            mtype: "新图",
            xzq: xzq
        },
        datatype: "json",
        success: function (result) {
            if (result) {
                var strs = new Array(); //定义一数组
                strs = result.split("||"); //字符分割
                for (i = 0; i < strs.length; i++) {
                    if (i == 0)
                        Fathervalue = strs[0];
                    else if (i == 1)
                        Childvalue = strs[1];
                }

                var fathervalue = JSON.parse(Fathervalue);
                var childvalue = JSON.parse(Childvalue);
                var newfathervalue = [];

                for (var i in fathervalue[0]) {
                    if (i.match("SUM")) {
                        if (i.match("K06H")) {
                            if (fathervalue[0][i] !== null)
                                newfathervalue.push(fathervalue[0][i]);
                            else
                                newfathervalue.push(0);
                        }
                    } else {
                        if (i.match("K06H")) {
                            if (fathervalue[0][i] !== null)
                                newfathervalue.push(fathervalue[0][i]);
                            else
                                newfathervalue.push(0);
                        }
                    }
                }
                //var EchartsTitle = "";
                var nameArr = ["火电工业用地", "钢铁工业用地", "煤矿工业用地", "水泥工业用地", "玻璃工业用地", "电解铝工业用地"]
                //document.getElementById("EchartsBarDiv").style.display = "block";
                var echartsDiv = document.getElementById("bardiv");
                //EchartsTitle = title + "柱形图";
                showEchartsBar(echartsDiv, nameArr, newfathervalue, "面积", title);
                var names = [];
                var nums = [];
                var data = []; //存放解析结果的数值
                var data2 = []; //存放解析结果的百分比
                for (var i = 0; i < nameArr.length; i++) {
                    data.push(nameArr[i]);
                }
                for (var i = 0; i < nameArr.length; i++) {
                    var d = Number(newfathervalue[i] / newfathervalue[i]).toFixed(3);
                    data2.push(d);
                }
                for (var i = 0; i < nameArr.length; i++) {
                    //names.push(obj[i].prov);
                    var obj1 = new Object();
                    obj1.name = nameArr[i];
                    obj1.value = newfathervalue[i + 3];
                    nums.push(obj1);
                }
                //document.getElementById("EchartsPieDiv").style.display = "block";
                var echartsDiv2 = document.getElementById("piediv");
                //EchartsTitle = title + "饼形图";
                //document.getElementById("echartslable").innerHTML = EchartsTitle;
                showEchartsPie(echartsDiv2, nameArr, nums, "面积", title);
            }
        }
    });
}

function getStatisticsData10(title, xzq) {
    //LinkToMap(title, xzq, "xzq");
    $("#table2").empty();
    var perValue = [];
    var perColName = [];
    var obj = {
        stype: "K10",
        mtype: "数据表",
        xzq: xzq
    };
    $.ajax({
        type: "post",
        async: false,
        url: statisticsConfig.ajax,
        data: obj,
        datatype: "json",
        success: function (result) {
            if (result) {
                var strs = new Array(); //定义一数组 
                strs = result.split("||"); //字符分割 
                for (i = 0; i < strs.length; i++) {
                    if (i == 0)
                        perValue = strs[0];
                    else if (i == 1)
                        perSumValue = strs[1];
                }
                var perValue1 = JSON.parse(perSumValue);
                var perSumValue = JSON.parse(perValue);
                var tbody = document.getElementById('table2');
                myparam = perSumValue[0].MC;
                for (var i = 0; i < perSumValue.length; i++) { //遍历一下json数据 
                    var trow = getSumDataRow(i, perSumValue[i]); //定义一个方法,返回tr数据 
                    tbody.appendChild(trow);
                }
                trow = getNullDataRow(1, perValue1[0]); //定义一个方法,返回tr数据 
                tbody.appendChild(trow);
                for (var i = 0; i < perValue1.length; i++) { //遍历一下json数据 
                    var trow = getDataRow(i, perValue1[i]); //定义一个方法,返回tr数据 
                    if ((perValue1[i].DM).toString().length <= 9) {
                        trow.setAttribute("onclick", "getStatisticsData10(" + "'" + title + "'" + "," + "'" + perValue1[i].DM + "'" + ")");
                    } else {
                        trow.setAttribute("onclick", "getStatisticsData10(" + "'" + title + "'" + "," + "'" + perValue1[i].DM + "'" + ",'xzq')");
                    }
                    tbody.appendChild(trow);
                }
            }
        }
    });
    var value1 = [];
    var xAxis1 = [];
    var data = []; //存放解析结果的数值
    var data2 = []; //存放解析结果的百分比  
    $.ajax({
        type: "post",
        async: false,
        url: statisticsConfig.ajax,
        data: //发送到服务器的参数
        {
            stype: "K10",
            mtype: "新柱状图",
            xzq: xzq
        },
        datatype: "json",
        success: function (result) {
            if (result) {
                var strs = new Array(); //定义一数组 
                strs = result.split("||"); //字符分割 
                for (i = 0; i < strs.length; i++) {
                    if (i == 0)
                        perValue = strs[0];
                    else if (i == 1)
                        perSumValue = strs[1];
                }
                var perSumValue = JSON.parse(perSumValue);
                var perValue1 = JSON.parse(perValue);
                for (var i in perValue1[0]) {
                    if (perValue1[0][i] !== null)
                        value1.push(perValue1[0][i]); //遍历月份并填入数组
                    else
                        value1.push(0);
                }
                value1.shift();
                value1.shift();
                value1.shift();
                for (var j = 0; j < perSumValue.length; j++) {
                    xAxis1.push(perSumValue[j].FD_VALUE); //遍历月份并填入数组
                }
                //var EchartsTitle = "";
                //document.getElementById("EchartsBarDiv").style.display = "block";
                var echartsDiv = document.getElementById("bardiv");
                //EchartsTitle = title + "柱形图";
                showEchartsBar(echartsDiv, xAxis1, value1, "面积", title);
                var names = [];
                var nums = []; //存放pie的对象
                var s = 0;
                for (var i = 0; i < value1.length; i++) {
                    data.push(value1[i]);
                    s = s + parseFloat(data[i]);
                }
                for (var i = 0; i < value1.length; i++) {
                    //var d=Number(obj[i].dataval/s*100).toFixed(2);
                    //d=d+"%";
                    //d=parseFloat(d);
                    var d = Math.round(value1[i] * 100 / s) / 100;
                    data2.push(d);
                }
                for (var i = 0; i < value1.length; i++) {
                    //names.push(obj[i].prov);
                    var obj1 = new Object();
                    obj1.name = xAxis1[i];
                    obj1.value = value1[i];
                    nums.push(obj1);
                }
                //document.getElementById("EchartsPieDiv").style.display = "block";
                var echartsDiv2 = document.getElementById("piediv");
                //EchartsTitle = title + "饼形图";
                //document.getElementById("echartslable").innerHTML = EchartsTitle;
                showEchartsPie(echartsDiv2, xAxis1, nums, "面积", title);
            }
        }

    });
}

function getStatisticsData11(title, xzq) {
    //LinkToMap(title, xzq, "xzq");
    $("#table2").empty();
    var perValue = [];
    var perColName = [];
    var myparam = "";
    var obj = {
        stype: "K11",
        mtype: "数据表",
        xzq: xzq
    };
    $.ajax({
        type: "post",
        async: false,
        url: statisticsConfig.ajax,
        data: obj,
        datatype: "json",
        success: function (result) {
            if (result) {
                var strs = new Array(); //定义一数组 
                strs = result.split("||"); //字符分割 
                for (i = 0; i < strs.length; i++) {
                    if (i == 0)
                        perValue = strs[0];
                    else if (i == 1)
                        perSumValue = strs[1];
                }
                var perSumValue = JSON.parse(perSumValue);
                var perValue1 = JSON.parse(perValue);
                var tbody = document.getElementById('table2');
                myparam = perValue1[0].MC;
                for (var i = 0; i < perValue1.length; i++) { //遍历一下json数据 
                    var trow = getDataRow(i, perValue1[i]); //定义一个方法,返回tr数据 
                    tbody.appendChild(trow);
                }
                trow = getNullDataRow(1, perValue1[0]); //定义一个方法,返回tr数据 
                tbody.appendChild(trow);
                for (var i = 0; i < perSumValue.length; i++) { //遍历一下json数据 
                    var trow = getSumDataRow(i, perSumValue[i]); //定义一个方法,返回tr数据 
                    if ((perSumValue[i].DM).toString().length <= 9) {
                        trow.setAttribute("onclick", "getStatisticsData11(" + "'" + title + "'" + "," + "'" + perSumValue[i].DM + "'" + ")");
                    } else {
                        trow.setAttribute("onclick", "getStatisticsData11(" + "'" + title + "'" + "," + "'" + perSumValue[i].DM + "'" + ",'xzq')");
                    }
                    tbody.appendChild(trow);
                }
            }
        }
    });
    var name1 = [];
    var name2 = [];
    var value1 = [];
    var value2 = [];
    var xAxis1 = [];
    var xnames = [];
    $.ajax({
        type: "post",
        async: false,
        url: statisticsConfig.ajax,
        data: //发送到服务器的参数
        {
            stype: "K11",
            mtype: "新柱状图",
            xzq: xzq
        },
        datatype: "json",
        success: function (result) {
            if (result) {
                var strs = new Array(); //定义一数组 
                strs = result.split("||"); //字符分割 
                for (i = 0; i < strs.length; i++) {
                    if (i == 0)
                        perValue = strs[0];
                    else if (i == 1)
                        perSumValue = strs[1];
                }
                var perValue = JSON.parse(perValue);
                var perSumValue = JSON.parse(perSumValue);
                for (var i = 0; i < perSumValue.length; i++) {
                    //value1.push(perValue[i].dataval);    //遍历月份并填入数组
                    xAxis1.push(perSumValue[i].FD_VALUE);
                }
                for (var i in perValue[0]) {
                    if (i == "DM" || i == "MC" || i.match("_HJ"))
                        continue;
                    if (i.match("K20")) {
                        if (perValue[0][i] !== null)
                            value2.push(perValue[0][i]);
                        else
                            value2.push(0);
                    } else {
                        if (perValue[0][i] !== null)
                            value1.push(perValue[0][i]);
                        else
                            value1.push(0);
                    }
                }
                for (var i = 0; i < xAxis1.length; i++) {
                    if (i <= 3)
                        name1.push(xAxis1[i]);
                    else
                        name2.push(xAxis1[i]);
                }
                //var EchartsTitle = "";
                //document.getElementById("echartslable").innerHTML = "";
                //document.getElementById("EchartsBarDiv").style.display = "block";
                var echartsDiv = document.getElementById("bardiv");
                //EchartsTitle = title + "柱形图";
                showEchartsBar(echartsDiv, name1, value1, "面积", title);
                //document.getElementById("EchartsPieDiv").style.display = "block";
                var echartsDiv2 = document.getElementById("piediv");
                showEchartsBar(echartsDiv2, name2, value2, "面积", title);
            }
        }
    });
}

function getStatisticsData12(title, xzq) {
    //LinkToMap(title, xzq, "xzq");
    $("#table2").empty();
    var perValue = [];
    var perColName = [];
    var obj = {
        stype: "K12",
        mtype: "数据表",
        xzq: xzq
    };
    $.ajax({
        type: "post",
        async: false,
        url: statisticsConfig.ajax,
        data: obj,
        datatype: "json",
        success: function (result) {
            if (result) {
                var strs = new Array(); //定义一数组 
                strs = result.split("||"); //字符分割 
                for (i = 0; i < strs.length; i++) {
                    if (i == 0)
                        perValue = strs[0];
                    else if (i == 1)
                        perSumValue = strs[1];
                }
                var perValue1 = JSON.parse(perSumValue);
                var perSumValue = JSON.parse(perValue);
                var tbody = document.getElementById('table2');
                myparam = perSumValue[0].MC;
                for (var i = 0; i < perSumValue.length; i++) { //遍历一下json数据 
                    var trow = getSumDataRow(i, perSumValue[i]); //定义一个方法,返回tr数据 
                    tbody.appendChild(trow);
                }
                trow = getNullDataRow(1, perValue1[0]); //定义一个方法,返回tr数据 
                tbody.appendChild(trow);
                for (var i = 0; i < perValue1.length; i++) { //遍历一下json数据 
                    var trow = getDataRow(i, perValue1[i]); //定义一个方法,返回tr数据 

                    if ((perValue1[i].DM).toString().length <= 9) {
                        trow.setAttribute("onclick", "getStatisticsData12(" + "'" + title + "'" + "," + "'" + perValue1[i].DM + "'" + ")");
                    } else {
                        trow.setAttribute("onclick", "getStatisticsData12(" + "'" + title + "'" + "," + "'" + perValue1[i].DM + "'" + ",'xzq')");
                    }
                    tbody.appendChild(trow);
                }
            }
        }
    });
    var value1 = [];
    var xAxis1 = [];
    var total;
    var zhu1 = []; //柱状图横坐标名字
    var zhu2 = []; //柱状图地类
    var zhu3 = []; //柱状图值
    $.ajax({
        type: "post",
        async: false,
        url: statisticsConfig.ajax,

        data:   //发送到服务器的参数
        {
            stype: "K12",
            mtype: "新柱状图",
            xzq: xzq
        },
        datatype: "json",
        success: function (result) {
            if (result) {
                var strs = new Array(); //定义一数组 
                strs = result.split("||"); //字符分割 
                for (i = 0; i < strs.length; i++) {
                    if (i == 0)
                        zhu1 = strs[0];
                    else if (i == 1)
                        zhu2 = strs[1];
                    else if (i == 2)
                        zhu3 = strs[2];
                }
                zhu1 = JSON.parse(zhu1);
                zhu2 = JSON.parse(zhu2);
                zhu3 = JSON.parse(zhu3);
                var bardata1 = [];
                var bardata2 = [];
                var bardata3 = [];
                var bardata4 = [];
                var bardata5 = [];
                var legenddata = [];
                var seriousdata = [];
                bardata5.push(bardata1);
                bardata5.push(bardata2);
                bardata5.push(bardata3);
                bardata5.push(bardata4);
                for (var l = 0; l < zhu3.length; l++) {
                    legenddata.push(zhu3[l].FD_VALUE)
                }
                for (var h = 0; h < zhu2.length; h++) {
                    xAxis1.push(zhu2[h].FD_VALUE);
                }
                for (var i in zhu1[0]) {
                    value1.push(zhu1[0][i]);
                }
                value1.shift();
                value1.shift();
                total = value1[0];
                value1.shift();
                for (var j = 0; j < zhu2.length; j++) {
                    if (value1[j * 4] !== null)
                        bardata1.push(value1[j * 4]);
                    else
                        bardata1.push(0);
                    if (value1[j * 4 + 1] !== null)
                        bardata2.push(value1[j * 4 + 1]);
                    else
                        bardata2.push(0);
                    if (value1[j * 4 + 2] !== null)
                        bardata3.push(value1[j * 4 + 2]);
                    else
                        bardata3.push(0);
                    if (value1[j * 4 + 3] !== null)
                        bardata4.push(value1[j * 4 + 3]);
                    else
                        bardata4.push(0);
                }
                var o = {};
                for (var k = 0; k < zhu3.length; k++) {
                    var o = new Object();
                    o["name"] = zhu3[k].FD_VALUE.toString();
                    o["type"] = 'bar';
                    o["data"] = bardata5[k];
                    o["itemStyle"] = {
                        normal: {
                            label: {
                                show: true, //开启显示
                                position: 'top', //在上方显示
                                textStyle: { //数值样式
                                    color: 'white',
                                    fontSize: 12
                                }
                            }
                        }
                    };
                    seriousdata.push(o);
                }
                //var EchartsTitle = "";
                //document.getElementById("EchartsBarDiv").style.display = "block";
                var echartsDiv = document.getElementById("bardiv");
                //EchartsTitle = title + "柱形图";
                showEchartsBar2(echartsDiv, xAxis1, seriousdata, "面积", title);
                var data = []; //存放解析结果的数值
                var data2 = []; //存放解析结果的百分比  
                var a1, a2, a3, a4, a5 = 0;
                var names = [];
                var nums = [];
                var a6 = [];
                a6.push(a1);
                a6.push(a2);
                a6.push(a3);
                a6.push(a4);
                a6.push(a5);
                for (var m = 0; m < xAxis1.length; m++) {
                    a6[m] = parseFloat(value1[m * 4 + 0]);
                }
                for (var i = 0; i < xAxis1.length; i++) {
                    var d = Number(a6[i] / total).toFixed(2);
                    data2.push(d);
                }
                for (var i = 0; i < xAxis1.length; i++) {
                    var obj1 = new Object();
                    obj1.name = xAxis1[i];
                    obj1.value = a6[i];
                    nums.push(obj1);
                }
                //document.getElementById("EchartsPieDiv").style.display = "block";
                var echartsDiv2 = document.getElementById("piediv");
                //EchartsTitle = title + "饼形图";
                //document.getElementById("echartslable").innerHTML = EchartsTitle;
                showEchartsPie(echartsDiv2, xAxis1, nums, "面积", title);
            }
        }
    });
}

function getStatisticsData13(title, xzq) {
    //LinkToMap(title, xzq, "xzq");
    $("#table2").empty();
    var obj = {
        stype: "K13",
        mtype: "数据表",
        xzq: xzq
    }
    var perValue = [];
    var perColName = [];
    var value1 = []; //柱状图纵坐标（一级地类）
    var xAxis1 = []; //柱状图横轴（一级地类）
    var code1 = []; //一级地类编码
    var code2 = []; //二级地类编码
    var str1 = ""; //code1拼成字符串
    var str2 = ""; //code2拼成字符串
    var yijiname = null; //一级地类json
    var erjiname = null; //二级地类json 
    var arrayyiji = []; //一级地类数组   
    var arrayerji = []; //二级地类数组
    $.ajax({
        type: "post",
        async: false,
        url: statisticsConfig.ajax,
        data: obj,
        datatype: "json",
        success: function (result) {
            if (result) {
                var strs = new Array(); //定义一数组 
                strs = result.split("||"); //字符分割 
                for (i = 0; i < strs.length; i++) {
                    if (i == 0)
                        perValue = strs[0];
                    else if (i == 1)
                        perSumValue = strs[1];
                }
                var perSumValue = JSON.parse(perSumValue);
                var perValue1 = JSON.parse(perValue);
                if (perValue1.length == 0) {
                    alert("数据库内容为空！！！")
                    return;
                }
                myparam = perValue1[0].MC;
                var tbody = document.getElementById('table2');
                for (var i = 0; i < perValue1.length; i++) { //遍历一下json数据 
                    var trow = getDataRow(i, perValue1[i]); //定义一个方法,返回tr数据 
                    tbody.appendChild(trow);
                }
                trow = getNullDataRow(1, perValue1[0]); //定义一个方法,返回tr数据 
                tbody.appendChild(trow);
                for (var i = 0; i < perSumValue.length; i++) { //遍历一下json数据 
                    var trow = getSumDataRow(i, perSumValue[i]); //定义一个方法,返回tr数据 
                    if ((perSumValue[i].DM).toString().length <= 9) {
                        trow.setAttribute("onclick", "getStatisticsData13(" + "'" + title + "'" + "," + "'" + perSumValue[i].DM + "'" + ")");
                    } else {
                        trow.setAttribute("onclick", "getStatisticsData13(" + "'" + title + "'" + "," + "'" + perSumValue[i].DM + "'" + ",'xzq')");
                    }
                    tbody.appendChild(trow);
                }
                for (var i in perValue1[0]) {
                    if (i.match("SUM")) {
                        if (i.match("K") && i.length == 8) {
                            if (perValue1[0][i] !== null)
                                value1.push(perValue1[0][i]);
                            else
                                value1.push(0);
                            code1.push("'" + i.substring(5, i.length - 1) + "'");
                        }
                        if (i.match("K") && i.length != 8) {
                            code2.push("'" + i.substring(5, i.length - 1) + "'");
                        }
                    } else {
                        if (i.match("K") && i.length == 3) {
                            if (perValue1[0][i] !== null)
                                value1.push(perValue1[0][i]);
                            else
                                value1.push(0);
                            code1.push("'" + i.substring(1) + "'");
                        }
                        if (i.match("K") && i.length != 3) {
                            code2.push("'" + i.substring(1) + "'");
                        }
                    }
                }
                for (var i = 0; i < code1.length; i++) {
                    str1 = str1 + "+" + code1[i];
                }
                //str1 = str1.substr(1); 
                for (var i = 0; i < code2.length; i++) {
                    str2 = str2 + "+" + code2[i];
                }
                //str2 = str2.substr(1); 
            }
        }
    });
    $.ajax({
        type: "post",
        async: false,
        url: statisticsConfig.ajax,
        data:   //发送到服务器的参数
        {
            stype: "K13",
            mtype: "新柱状图",
            xzq: xzq,
            str1: str1,
            str2: str2
        },
        datatype: "json",
        success: function (result) {
            if (result) {
                var strs = new Array(); //定义一数组 
                strs = result.split("||"); //字符分割 
                for (i = 0; i < strs.length; i++) {
                    if (i == 0)
                        yijiname = strs[0];
                    else if (i == 1)
                        erjiname = strs[1];
                }
                yijiname = JSON.parse(yijiname);
                erjiname = JSON.parse(erjiname);
                for (var i = 0; i < yijiname.length; i++) {
                    arrayyiji.push(yijiname[i].FD_VALUE);
                }
                for (var i = 0; i < erjiname.length; i++) {
                    arrayerji.push(erjiname[i].FD_VALUE);
                }
                var EchartsTitle = "";
                //document.getElementById("EchartsBarDiv").style.display = "block";
                var echartsDiv = document.getElementById("bardiv");
                //EchartsTitle = title + "柱形图";
                showEchartsBar(echartsDiv, arrayyiji, value1, "面积", title);
                var data = []; //存放解析结果的数值
                var data2 = []; //存放解析结果的百分比  
                var names = [];
                var nums = [];
                var s = 0;
                for (var i = 0; i < yijiname.length; i++) {
                    //names.push(obj[i].prov);            
                    var obj1 = new Object();
                    obj1.name = arrayyiji[i];
                    obj1.value = value1[i];
                    nums.push(obj1);
                }
                //document.getElementById("EchartsPieDiv").style.display = "block";
                var echartsDiv2 = document.getElementById("piediv");
                //EchartsTitle = title + "饼形图";
                //document.getElementById("echartslable").innerHTML = EchartsTitle;
                showEchartsPie(echartsDiv2, arrayyiji, nums, "面积", title);
            }
        }
    });
}

function getStatisticsData14(title, xzq) {
    //LinkToMap(title, xzq, "xzq");
    $("#table2").empty();
    var obj = {
        stype: "K14",
        mtype: "新数据",
        xzq: xzq,
        text: "'湿地'"
    };
    var perValue = [];
    var perColName = [];
    var landname = [];
    var myparam = "";
    var Landtype = []; //二级地类
    var Fatherlandtype = []; //一级地类
    var Fathervalue = [];
    var FatherName = [];
    var Childvalue = [];
    var Myland = [];
    var Theparam = "";
    var mylandvalue = [];
    var x = [];
    var xingzhengqudata = []; //x坐标值
    var seriesdata = []; //y坐标值
    var hejiData = [];
    var newValue = [];
    var aparam = "";
    var mynums = [];
    $.ajax({
        type: "post",
        async: false,
        url: statisticsConfig.ajax,
        data: obj,
        datatype: "json",
        success: function (result) {
            if (result) {
                var strs = new Array(); //定义一数组 
                strs = result.split("||"); //字符分割 
                for (i = 0; i < strs.length; i++) {
                    if (i == 0)
                        perValue = strs[0];
                    else if (i == 1)
                        perSumValue = strs[1];
                    else if (i == 2)
                        Landtype = strs[2];
                    else if (i == 3)
                        Fatherlandtype = strs[3];
                    else if (i == 4)
                        Myland = strs[4];
                    else
                        Theparam = strs[5];
                }
                var perSumValue = JSON.parse(perSumValue);
                var perValue1 = JSON.parse(perValue);
                if (perValue1.length == 0) {
                    alert("数据库内容为空！！！")
                    return;
                }
                hejiData = perValue1;
                aparam = "";
                aparam = perValue1[0].MC;
                var landtype = JSON.parse(Landtype);
                var fatherlandtype = JSON.parse(Fatherlandtype);
                var myland = JSON.parse(Myland);
                var newmyland = [];
                for (var i = 0; i < myland.length; i++) {
                    newmyland.push(myland[i].FD_VALUE);
                }
                var theparam = "K" + Theparam;
                var tbody = document.getElementById('table2');
                for (var i = 0; i < perValue1.length; i++) { //遍历一下json数据 
                    var trow = getSumDataRow(i, perValue1[i]); //定义一个方法,返回tr数据 
                    tbody.appendChild(trow);
                }
                trow = getNullDataRow(1, perValue1[0]); //定义一个方法,返回tr数据 
                tbody.appendChild(trow);
                for (var i = 0; i < perSumValue.length; i++) { //遍历一下json数据 
                    var trow = getDataRow(i, perSumValue[i]); //定义一个方法,返回tr数据 
                    if ((perSumValue[i].DM).toString().length <= 9) {
                        trow.setAttribute("onclick", "getStatisticsData14(" + "'" + title + "'" + "," + "'" + perSumValue[i].DM + "'" + ")");
                    } else {
                        trow.setAttribute("onclick", "getStatisticsData14(" + "'" + title + "'" + "," + "'" + perSumValue[i].DM + "'" + ",'xzq')");
                    }
                    tbody.appendChild(trow);
                }
                for (var i in perValue1[0]) {
                    if (i.indexOf(theparam) != -1) {
                        if (perValue1[0][i] !== null)
                            mylandvalue.push(perValue1[0][i]);
                        else
                            mylandvalue.push(0);
                    }

                }
                mylandvalue.shift();
                var mypercent = [];
                for (var i = 0; i < myland.length; i++) {
                    mypercent.push(Number(mylandvalue[i] / perValue1[0].K01).toFixed(3));
                }
                //var mynums = [];
                for (var i = 0; i < newmyland.length; i++) {
                    var obj1 = new Object();
                    obj1.name = newmyland[i];
                    obj1.value = mylandvalue[i];
                    mynums.push(obj1);
                }
                for (var i in hejiData[0]) {
                    if (i == "SUM(K09)" || i == "K09")
                        continue;
                    if (i.match("SUM")) {
                        if (i.match("K") && i.length == 8) {
                            if (hejiData[0][i] !== null)
                                newValue.push(hejiData[0][i]);
                            else
                                newValue.push(0);
                        }
                    } else {
                        if (i.match("K") && i.length == 3) {
                            if (hejiData[0][i] !== null)
                                newValue.push(hejiData[0][i]);
                            else
                                newValue.push(0);
                        }
                    }
                }
                for (var i = 0; i < newmyland.length; i++) {
                    var obj1 = new Object();
                    obj1.name = newmyland[i];
                    obj1.value = newValue[i];
                    mynums.push(obj1);
                }
                //var EchartsTitle = "";
                //document.getElementById("EchartsBarDiv").style.display = "block";
                var echartsDiv = document.getElementById("bardiv");
                //EchartsTitle = title + "柱形图";
                showEchartsBar(echartsDiv, newmyland, newValue, "面积", title);
                //document.getElementById("EchartsPieDiv").style.display = "block";
                var echartsDiv2 = document.getElementById("piediv");
                //EchartsTitle = title + "饼形图";
                //document.getElementById("echartslable").innerHTML = EchartsTitle;
                showEchartsPie(echartsDiv2, newmyland, mynums, "面积", title);
            }
        }
    })
}

function getStatisticsData15(title, xzq) {
    //LinkToMap(title, xzq, "xzq");
    $("#table2").empty();
    var perValue = [];
    var perColName = [];
    var fatherlandname = [];
    var fatherlandvalue = [];
    var myparam = "";
    var Landtype = [];
    var Fathervalue = [];
    var Childvalue = [];
    var newValue = [];
    var mynums = [];
    var nums = [];
    var obj = {
        stype: "K15",
        mtype: "数据表",
        xzq: xzq
    };
    $.ajax({
        type: "post",
        async: false,
        url: statisticsConfig.ajax,
        data: obj,
        datatype: "json",
        success: function (result) {
            if (result) {
                var strs = new Array(); //定义一数组
                strs = result.split("||"); //字符分割
                var fatherland;
                for (i = 0; i < strs.length; i++) {
                    if (i == 0)
                        perValue = strs[0];
                    else if (i == 1)
                        perSumValue = strs[1];
                    else if (i == 2)
                        fatherland = JSON.parse(strs[2]);
                }
                for (var i = 0; i < fatherland.length; i++) {
                    //                    var newOption = document.createElement("option");
                    //                    newOption.text = fatherland[i].FD_VALUE;
                    fatherlandname.push(fatherland[i].FD_VALUE);
                    //                    document.getElementById("selection").add(newOption);
                    fatherlandvalue.push(fatherland[i].FD_VALUE);
                }
                var perSumValue = JSON.parse(perSumValue);
                var perValue1 = JSON.parse(perValue);
                var tbody = document.getElementById('table2');
                myparam = perValue1[0].MC;
                for (var i = 0; i < perValue1.length; i++) { //遍历一下json数据
                    var trow = getDataRow(i, perValue1[i]); //定义一个方法,返回tr数据
                    tbody.appendChild(trow);
                }
                trow = getNullDataRow(1, perValue1[0]); //定义一个方法,返回tr数据
                tbody.appendChild(trow);
                for (var i = 0; i < perSumValue.length; i++) { //遍历一下json数据
                    var trow = getSumDataRow(i, perSumValue[i]); //定义一个方法,返回tr数据
                    if ((perSumValue[i].DM).toString().length <= 9) {
                        trow.setAttribute("onclick", "getStatisticsData15(" + "'" + title + "'" + "," + "'" + perSumValue[i].DM + "'" + ")");
                    } else {
                        trow.setAttribute("onclick", "getStatisticsData15(" + "'" + title + "'" + "," + "'" + perSumValue[i].DM + "'" + ",'xzq')");
                    }
                    tbody.appendChild(trow);
                }
            }
        }
    });
    var value1 = [];
    var xAxis1 = [];
    $.ajax({
        type: "post",
        async: false,
        url: statisticsConfig.ajax,
        data:   //发送到服务器的参数
        {
            stype: "K15",
            mtype: "新图",
            xzq: xzq
        },
        datatype: "json",
        success: function (result) {
            if (result) {
                var strs = new Array(); //定义一数组
                strs = result.split("||"); //字符分割
                for (i = 0; i < strs.length; i++) {
                    if (i == 0)
                        Fathervalue = strs[0];
                    else if (i == 1)
                        Childvalue = strs[1];
                }
                var fathervalue = JSON.parse(Fathervalue);
                var childvalue = JSON.parse(Childvalue);
                var newfathervalue = [];
                for (var i in fathervalue[0]) {
                    if (i.match("SUM")) {
                        if (i.match("K") && i.length == 8) {
                            if (fathervalue[0][i] !== null)
                                newValue.push(fathervalue[0][i]);
                            else
                                newValue.push(0);
                        }
                    } else {
                        if (i.match("K") && i.length == 3) {
                            if (fathervalue[0][i] !== null)
                                newValue.push(fathervalue[0][i]);
                            else
                                newValue.push(0);
                        }
                    }
                }
                fatherlandname[0] = "耕地";
                fatherlandname[1] = "湿地";
                for (var i = 0; i < fatherlandname.length; i++) {
                    var obj1 = new Object();
                    obj1.name = fatherlandname[i];
                    obj1.value = newValue[i];
                    nums.push(obj1);
                }
                //var EchartsTitle = "";
                //document.getElementById("EchartsBarDiv").style.display = "block";
                var echartsDiv = document.getElementById("bardiv");
                //EchartsTitle = title + "柱形图";
                showEchartsBar(echartsDiv, fatherlandname, newValue, "面积", title);
                //document.getElementById("EchartsPieDiv").style.display = "block";
                var echartsDiv2 = document.getElementById("piediv");
                //EchartsTitle = title + "饼形图";
                //document.getElementById("echartslable").innerHTML = EchartsTitle;
                showEchartsPie(echartsDiv2, fatherlandname, nums, "面积", title);
            }
        }
    });
}

function getStatisticsData17(title, xzq) {
    //LinkToMap(title, xzq, "xzq");
    $("#table2").empty();
    var perValue = [];
    var perColName = [];
    var myparam = "";
    var Landtype = [];
    var Landtype2 = [];
    var FQValue = [];
    var LJValue = [];
    var Landname = [];
    var FQLandname = [];
    var LJLandname = [];
    var obj = {
        stype: "K17",
        mtype: "数据表",
        xzq: xzq
    };
    $.ajax({
        type: "post",
        async: false,
        url: statisticsConfig.ajax,
        data: obj, //发送到服务器的参数        
        datatype: "json",
        success: function (result) {
            if (result) {
                var strs = new Array(); //定义一数组
                strs = result.split("||"); //字符分割
                for (i = 0; i < strs.length; i++) {
                    if (i == 0)
                        perValue = strs[0];
                    else if (i == 1)
                        perSumValue = strs[1];
                    else if (i == 2)
                        Landname = JSON.parse(strs[2]);
                }
                var perSumValue = JSON.parse(perSumValue);
                var perValue1 = JSON.parse(perValue);
                var tbody = document.getElementById('table2');
                myparam = perValue1[0].MC;
                for (var i = 0; i < perValue1.length; i++) { //遍历一下json数据
                    var trow = getDataRow(i, perValue1[i]); //定义一个方法,返回tr数据
                    tbody.appendChild(trow);
                }
                trow = getNullDataRow(1, perValue1[0]); //定义一个方法,返回tr数据
                tbody.appendChild(trow);
                for (var i = 0; i < perSumValue.length; i++) { //遍历一下json数据
                    var trow = getSumDataRow(i, perSumValue[i]); //定义一个方法,返回tr数据
                    if ((perSumValue[i].DM).toString().length <= 9) {
                        trow.setAttribute("onclick", "getStatisticsData17(" + "'" + title + "'" + "," + "'" + perSumValue[i].DM + "'" + ")");
                    } else {
                        trow.setAttribute("onclick", "getStatisticsData17(" + "'" + title + "'" + "," + "'" + perSumValue[i].DM + "'" + ",'xzq')");
                    }
                    tbody.appendChild(trow);
                }
                for (var j in Landname) {
                    if (Landname[j].FIELDALIASNAME.match("小计")) {
                        continue;
                    }
                    if (Landname[j].FIELDALIASNAME.match("FQ")) {
                        FQLandname.push(Landname[j].FIELDALIASNAME.split('_')[1]);
                    } else if (Landname[j].FIELDALIASNAME.match("LJTM")) {
                        LJLandname.push(Landname[j].FIELDALIASNAME.split('_')[1]);
                    } else
                        continue;
                }
                for (var j in perValue1[0]) {
                    if (j == "DM" || j == "MC") {
                        continue;
                    }
                    if (j.match("SUM")) {
                        if (j.match("FQ")) {
                            if (j.match("_XJ"))
                                continue;
                            if (perValue1[0][j] !== null)
                                FQValue.push(perValue1[0][j]);
                            else
                                FQValue.push(0);
                        } else if (j.match("LJTM")) {
                            if (j.match("_XJ"))
                                continue;
                            if (perValue1[0][j] !== null)
                                LJValue.push(perValue1[0][j]);
                            else
                                LJValue.push(0);
                        } else
                            continue;
                    } else {
                        if (j.match("FQ")) {
                            if (j.match("_XJ"))
                                continue;
                            if (perValue1[0][j] !== null)
                                FQValue.push(perValue1[0][j]);
                            else
                                FQValue.push(0);
                        } else if (j.match("LJTM")) {
                            if (j.match("_XJ"))
                                continue;
                            if (perValue1[0][j] !== null)
                                LJValue.push(perValue1[0][j]);
                            else
                                LJValue.push(0);
                        } else
                            continue;
                    }
                }
                //var EchartsTitle = "";
                //document.getElementById("echartslable").innerHTML = "";
                //document.getElementById("EchartsBarDiv").style.display = "block";
                var echartsDiv = document.getElementById("bardiv");
                //EchartsTitle = title + "柱形图";
                showEchartsBar(echartsDiv, FQLandname, FQValue, "面积", title);
                //document.getElementById("EchartsPieDiv").style.display = "block";
                var echartsDiv2 = document.getElementById("piediv");
                showEchartsBar(echartsDiv2, LJLandname, LJValue, "面积", title);
            }
        }
    });
}

function getStatisticsData18(title, xzq) {
    //LinkToMap(title, xzq, "xzq");
    $("#table2").empty();
    var perValue = [];
    var perColName = [];
    var myparam = "";
    var alldata = []; //x坐标值
    var xdata = []; //x坐标值
    var seriesdata = []; //y坐标值
    var seriesdata2 = []; //y坐标值
    $.ajax({
        type: "post",
        async: false,
        url: statisticsConfig.ajax,
        data: //发送到服务器的参数
        {
            stype: "K18",
            mtype: "数据表",
            xzq: xzq
        },
        datatype: "json",
        success: function (result) {
            if (result) {
                var strs = new Array(); //定义一数组
                strs = result.split("||"); //字符分割
                for (i = 0; i < strs.length; i++) {
                    if (i == 0)
                        perValue = strs[0];
                    else if (i == 1)
                        perSumValue = strs[1];
                    else if (i == 2)
                        alldata = JSON.parse(strs[2]);
                }
                var perSumValue = JSON.parse(perSumValue);
                var perValue1 = JSON.parse(perValue);
                myparam = perSumValue[0].MC;
                var tbody = document.getElementById('table2');
                for (var i = 0; i < perValue1.length; i++) { //遍历一下json数据
                    var trow = getDataRow(i, perValue1[i]); //定义一个方法,返回tr数据
                    tbody.appendChild(trow);
                }
                trow = getNullDataRow(1, perValue1[0]); //定义一个方法,返回tr数据
                tbody.appendChild(trow);
                for (var i = 0; i < perSumValue.length; i++) { //遍历一下json数据
                    var trow = getSumDataRow(i, perSumValue[i]); //定义一个方法,返回tr数据
                    if ((perSumValue[i].DM).toString().length <= 9) {
                        trow.setAttribute("onclick", "getStatisticsData18(" + "'" + title + "'" + "," + "'" + perSumValue[i].DM + "'" + ")");
                    } else {
                        trow.setAttribute("onclick", "LinkToMap(" + "'" + title + "'" + "," + "'" + perSumValue[i].DM + "'" + ",'xzq')");
                    }
                    tbody.appendChild(trow);
                }
                for (var j in alldata) {
                    xdata.push(alldata[j].FIELDALIASNAME.split('_')[1]);
                }
                xdata.shift();
                for (var j in perValue1[0]) {
                    if (j == "DM" || j == "MC") {
                        continue;
                    }
                    if (j.match("SUM")) {
                        if (j.match("GCHF")) {
                            if (j.match("_XJ"))
                                continue;
                            if (perValue1[0][j] !== null)
                                seriesdata.push(perValue1[0][j]);
                            else
                                seriesdata.push(0);
                        } else if (j.match("JKHF")) {
                            if (j.match("_XJ"))
                                continue;
                            if (perValue1[0][j] !== null)
                                seriesdata2.push(perValue1[0][j]);
                            else
                                seriesdata2.push(0);
                        } else
                            continue;
                    } else {
                        if (j.match("GCHF")) {
                            if (j.match("_XJ"))
                                continue;
                            if (perValue1[0][j] !== null)
                                seriesdata.push(perValue1[0][j]);
                            else
                                seriesdata.push(0);
                        } else if (j.match("JKHF")) {
                            if (j.match("_XJ"))
                                continue;
                            if (perValue1[0][j] !== null)
                                seriesdata2.push(perValue1[0][j]);
                            else
                                seriesdata2.push(0);
                        } else
                            continue;
                    }
                }
                //var EchartsTitle = "";
                //document.getElementById("EchartsBarDiv").style.display = "block";
                var echartsDiv = document.getElementById("bardiv");
                //EchartsTitle = title + "柱形图";
                showEchartsBar(echartsDiv, xdata, seriesdata2, "面积", title);
            }
        }
    })
}

function getStatisticsDataThreeType(title, xzq) {
    $("#table2").empty();
    var xzq1;
    var xzq2;
    var xzq3;
    $.ajax({
        type: "post",
        async: false,
        url: statisticsConfig.ajax,
        data: //发送到服务器的参数
        {
            stype: "sandalei",
            mtype: "数据表",
            xzq: xzq
        },
        datatype: "json",
        success: function (result) {
            if (result) {
                var totaldata = result.split('||');
                var data1 = totaldata[0];
                var data2 = totaldata[1];
                var data3 = totaldata[2];
                var citydata = JSON.parse(data1);
                var countydata = JSON.parse(data2);
                var villagedata = JSON.parse(data3);
                var tbody = document.getElementById('table2');
                //市数据，柱状图应该显示县的内容
                for (var i = 0; i < citydata.length; i++) {
                    var trow = getCityDataRow(i, citydata[i]);
                    xzq1 = citydata[i].DM;
                    // trow.setAttribute("onclick", "ChildDataSearch("+xzq1+")");
                    // tbody.appendChild(trow);
                    tbody.appendChild(trow);
                    $(trow).on('click', function () {
                        ChildDataSearch(xzq1)
                    })
                }
                //县数据,柱状图应该显示镇的内容
                for (var i = 0; i < countydata.length; i++) {
                    var trow = getCountyDataRow(i, countydata[i]);
                    xzq2 = countydata[i].DM;
                    // trow.setAttribute("onclick", "ChildDataSearch("+xzq2+")");
                    // tbody.appendChild(trow);
                    tbody.appendChild(trow);
                    $(trow).on('click', function () {
                        ChildDataSearch(xzq2)
                    })
                }
                //镇数据,柱状图应该显示村的内容
                for (var i = 0; i < villagedata.length; i++) {
                    var trow = getVillageDataRow(i, villagedata[i]);
                    xzq3 = villagedata[i].DM;
                    // trow.setAttribute("onclick", "ChildDataSearch("+xzq3+")");
                    let a = villagedata[i].DM;
                    tbody.appendChild(trow);
                    $(trow).on('click', function () {
                        ChildDataSearch(a, trow)
                    })
                }
                ChildDataSearch(xzq);

                function getCityDataRow(i, citydata) {
                    var row = document.createElement('tr');
					var fieldList = ["MC","DM",'NYD',"JSYD","WLYD"];
					for(var  k = 0 ; k < fieldList.length ; k ++){
						var nameCell = document.createElement('td');
                        nameCell.setAttribute("style", "border: 1px solid #060709;");
                        nameCell.innerHTML = citydata[fieldList[k]];
                        row.appendChild(nameCell);
					}
                    return row;
                }

                function getCountyDataRow(i, countydata) {
                    var row = document.createElement('tr');
                    var fieldList = ["MC","DM",'NYD',"JSYD","WLYD"];
					for(var  k = 0 ; k < fieldList.length ; k ++){
						var nameCell = document.createElement('td');
                        nameCell.setAttribute("style", "border: 1px solid #060709;");
                        nameCell.innerHTML = countydata[fieldList[k]];
                        row.appendChild(nameCell);
					}
                    return row;
                }

                function getVillageDataRow(i, villagedata) {
                    var row = document.createElement('tr');
                    $(row).attr("xzq", villagedata.DM);
                    for (var j in villagedata) {
                        var nameCell = document.createElement('td');
                        nameCell.setAttribute("style", "border: 1px solid #060709;");
                        nameCell.innerHTML = villagedata[j];
                        row.appendChild(nameCell);
                    }
                    return row;
                }
            }
        }
    });
}



function getDataRow(i, perValue) {
    var row = document.createElement('tr'); //创建行
    for (var j in perValue) {
        var nameCell = document.createElement('td'); //创建第二列name
        nameCell.setAttribute("style", "border: 1px solid #060709;");
        if (perValue[j] !== null) {
            if (typeof (perValue[j]) == "string" && !perValue[j].match("1504") && perValue[j].length > 4) {
                nameCell.innerHTML = perValue[j].substring(0, 4) + "...";
                nameCell.title = perValue[j];
            } else {
                nameCell.innerHTML = perValue[j];
                nameCell.title = perValue[j];
            }
        } else {
            nameCell.innerHTML = 0;
            nameCell.title = perValue[j];
        }
        row.appendChild(nameCell);
    }
    return row; //返回tr数据
}

    
function ChildDataSearch(xzq5, trow) {
    if (trow && trow.hasOwnProperty("xzq"))
        xzq5 = $(trow).attr("xzq")
    xzq = xzq5;
    var typenames = []; //地的类型
    var xingzhengqudata = []; //x坐标值
    var seriesdata = []; //y坐标值 
    var color = ['#ff7f50', '#87cefa', '#da70d6', '#32cd32', '#6495ed',
        '#ff69b4', '#ba55d3', '#cd5c5c', '#ffa500', '#40e0d0',
        '#1e90ff', '#ff6347', '#7b68ee', '#00fa9a', '#ffd700',
        '#6699FF', '#ff6666', '#3cb371', '#b8860b', '#30e0e0'
    ];  
    $.ajax({                
        type: "post",
        async:  false,
        url: statisticsConfig.ajax,
        data:   //发送到服务器的参数
        {
            stype: "sandalei",
            mtype: "数据表",
            xzq: xzq
        },
        datatype:   "json",
        success:   function (result)  {                   
            if  (result)  {
                var totaldata = result.split('||');
                    var perValue = JSON.parse(totaldata[1]);
                var names = []; //
                var nums = [];
                var data1 = []; //农用地
                var data2 = []; //建设用地
                var data3 = []; //未利用地
                for (var i = 0; i < perValue.length; i++) { //遍历一下json数据                     
                    var perValue1 = perValue[i];
                    //for (var j in perValue1) {
                    xingzhengqudata.push(perValue1.MC);
                    data1.push(perValue1.NYD);
                    data2.push(perValue1.JSYD);
                    data3.push(perValue1.WLYD);
                    //}
                }
                var seriesdatas2 = new Object();
                seriesdatas2["name"] = '农用地';
                seriesdatas2["type"] = 'bar';
                seriesdatas2["smooth"] = 'true';
                seriesdatas2["areaStyle"] = color;
                seriesdatas2["data"] = data1;
                seriesdatas2["itemStyle"] = {
                    normal: {
                        label: {
                            show: true, //开启显示
                            position: 'top', //在上方显示
                            textStyle: { //数值样式
                                color: 'white',
                                fontSize: 12
                            }
                        }
                    }
                };
                seriesdata.push(seriesdatas2);
                var seriesdatas3 = new Object();
                seriesdatas3["name"] = '建设用地';
                seriesdatas3["type"] = 'bar';
                seriesdatas3["smooth"] = 'true';
                seriesdatas3["areaStyle"] = '{}';
                seriesdatas3["data"] = data2;
                seriesdatas3["itemStyle"] = {
                    normal: {
                        label: {
                            show: true, //开启显示
                            position: 'top', //在上方显示
                            textStyle: { //数值样式
                                color: 'white',
                                fontSize: 12
                            }
                        }
                    }
                };
                seriesdata.push(seriesdatas3);
                var seriesdatas4 = new Object();
                seriesdatas4["name"] = '未利用地';
                seriesdatas4["type"] = 'bar';
                seriesdatas4["smooth"] = 'true';
                seriesdatas4["areaStyle"] = '{}';
                seriesdatas4["data"] = data3;
                seriesdatas4["itemStyle"] = {
                    normal: {
                        label: {
                            show: true, //开启显示
                            position: 'top', //在上方显示
                            textStyle: { //数值样式
                                color: 'white',
                                fontSize: 12
                            }
                        }
                    }
                };
                seriesdata.push(seriesdatas4);
                //document.getElementById("EchartsBarDiv").style.display = "block";
                var echartsDiv = document.getElementById("bardiv");
                //EchartsTitle = title + "柱形图";
                showEchartsBar2(echartsDiv, xingzhengqudata, seriesdata, "面积", "");
            }
        }
    })
}

function getSumDataRow(i, perValue) {
    var row = document.createElement('tr'); //创建行
    for (var j in perValue) {
        var nameCell = document.createElement('td'); //创建第二列name
        nameCell.setAttribute("style", "border: 1px solid #060709;cursor:pointer;");
        if (perValue[j] !== null) {
            if (typeof (perValue[j]) == "string" && !perValue[j].match("1504") && perValue[j].length > 4) {
                nameCell.innerHTML = perValue[j].substring(0, 4) + "...";
                nameCell.title = perValue[j];
            } else {
                nameCell.innerHTML = perValue[j];
                nameCell.title = perValue[j];
            }
        } else {
            nameCell.innerHTML = 0;
            nameCell.title = 0;
        }
        row.appendChild(nameCell);
    }
    return row; //返回tr数据
}

function getNullDataRow(i, perValue) {
    var row = document.createElement('tr'); //创建行
    if (i == 1) {
        for (var j in perValue) {
            var nameCell = document.createElement('td'); //创建第二列name
            nameCell.setAttribute("style", "border: 1px solid #060709;");
            nameCell.innerHTML = " &nbsp; ";
            row.appendChild(nameCell);
        }
    }
    return row; //返回tr数据
}

//返回初始化  
function Initialization(title) {
    var xzq = statisticsConfig.xzqCode;
    if (title === "土地利用现状一级分类地类面积汇总表") {
        getStatisticsData(title, xzq);
    } else if (title === "土地利用现状分类面积汇总表") {
        getStatisticsData2(title, xzq);
    } else if (title === "土地利用现状一级分类面积按权属性质汇总表") {
        getStatisticsData3(title, xzq);
    } else if (title === "耕地坡度分级面积汇总表") {
        getStatisticsData5(title, xzq);
    } else if (title === "耕地种植类型面积统计表") {
        getStatisticsData6(title, xzq);
    } else if (title === "林区范围内园地汇总统计表") {
        getStatisticsData7(title, xzq);
    } else if (title === "灌丛草地汇总情况统计表") {
        getStatisticsData8(title, xzq);
    } else if (title === "工业仓储用地按类型汇总统计表") {
        getStatisticsData9(title, xzq);
    } else if (title === "可调整地类面积汇总表") {
        getStatisticsData10(title, xzq);
    } else if (title === "部分细化地类面积汇总表") {
        getStatisticsData11(title, xzq);
    } else if (title === "耕地细化调查情况统计表") {
        getStatisticsData12(title, xzq);
    } else if (title === "批准未建设的建设用地用途情况统计表") {
        getStatisticsData13(title, xzq);
    } else if (title === "批准未建设的建设用地现状情况统计表") {
        getStatisticsData14(title, xzq);
    } else if (title === "永久基本农田现状情况统计表") {
        getStatisticsData15(title, xzq);
    } else if (title === "废弃与垃圾填埋细化标注汇总统计表") {
        getStatisticsData17(title, xzq);
    } else if (title === "即可恢复与工程恢复种植属性汇总统计表") {
        getStatisticsData18(title, xzq);
    }
}

function table2Excel(filename) {
    $("#store").table2excel({
        exclude: ".noExl", //class="noExl"的列不导出
        name: "Excel Document Name",
        filename: filename, //文件名称
        fileext: ".xls", //文件后缀名
        exclude_img: true, //导出图片
        exclude_links: true, //导出超链接
        exclude_inputs: true //导出输入框内容
    });
}


function LinkToMap(title, xzq, type) {
    switch (type) {
        case "xzq":
            if (!xzq || xzq === "1504") {
                break;
            }
            viewer ? removeAllEntities() : null;
            $.ajaxSettings.async = false;
            xzq = xzq === "1504" ? "150421" : xzq;
            var queryUrl = "http://192.168.1.5:8090/geoserver/AQ/wms?service=WFS&version=1.0.0&request=GetFeature&typeName=AQ:AQIXZQ&outputFormat=application/json&srsName=EPSG:4326&filter=<Filter xmlns='http://www.opengis.net/ogc' xmlns:gml='http://www.opengis.net/gml'><PropertyIsEqualTo wildCard='*' singleChar='.' escape='!'><PropertyName>XZQDM</PropertyName><Literal>" + xzq + "</Literal></PropertyIsEqualTo></Filter>";
            var result = null;
            $.getJSON(queryUrl, function (data) {
                result = data;
            });
            if (result && result.features && result.features.length > 0) {
                if (viewer) {
                    addSelectedXZQFeature(result.features[0].geometry, true);
                }
            } else {
                console.log("未获取到行政区数据！");
            }
            break;
        default:
            break;
    }
}